#!/bin/bash
# descpath.sh - File test operators

# for循环中，默认情况下，使用空白(空格、新行和制表键)来分隔域或者标识符
IFS=:               # 设置了域分隔符$IFS为":"之后，for使用":"分析它的域

for dir in $PATH;
do
    echo $dir
    if [ -w $dir ]; then        # 注意: ]前与[后必须有空格
        echo -e "\tYou have write permission in $dir"
    else
        echo -e "\tYou don't have write permission in $dir"
    fi

    if [ -O $dir ]; then
        echo -e "\tYou own $dir"
    else
        echo -e "\tYou don't own $dir"
    fi

    if [ -G $dir ]; then
        echo -e "\tYou are a member of $dir's group"
    else
        echo -e "\tYou aren't a member of $dir's group"
    fi
done


